import { fetchCount } from "../features/counter/counterAPI";
import {
  getHttp,
  postHttpForm,
  postHttpJSON,
  putHttp,
} from "../service/request";

// 获取医生列表
export function getDocterList(params) {
  return getHttp({ url: "/health/user/inquiry/v1/findDoctorList", params });
}

// 咨询医生
export function askDocter(doctorId: number) {
  return putHttp({
    url: "/health/user/inquiry/verify/v1/consultDoctor",
    params: { doctorId },
  });
}

// 获取当前咨询医生
export function queryUserRecord() {
  return getHttp({
    url: "/health/user/inquiry/verify/v1/findCurrentInquiryRecord",
  });
}

// 结束当前咨询医生
export function finishUserRecord(recordId: number) {
  return putHttp({
    url: "/health/user/inquiry/verify/v1/endInquiry",
    params: { recordId },
  });
}

interface ChatParams {
  inquiryId: number;
  page: number;
  count: number;
}

// 获取聊天记录接口
export function getChatListHistory(params: ChatParams) {
  return getHttp({
    url: "/health/user/inquiry/verify/v1/findInquiryRecordList",
    params,
  });
}

export interface FormParamState {
  inquiryId: number;
  content: string;
  type: 1;
  doctorId: number;
}

// 发送消息接口
export function putSendMessage(data: FormParamState) {
  return postHttpForm({
    url: "/health/user/inquiry/verify/v1/pushMessage",
    data,
  });
}
